<div class="problemindexholder" problemindex="C">
 <div class="ttypography">
  <div class="problem-statement">
   <div class="header">
    <div class="title">
     C. Solution for Cube
    </div>
    <div class="time-limit">
     <div class="property-title">
      time limit per test
     </div>
     2 seconds
    </div>
    <div class="memory-limit">
     <div class="property-title">
      memory limit per test
     </div>
     256 megabytes
    </div>
    <div class="input-file">
     <div class="property-title">
      input
     </div>
     standard input
    </div>
    <div class="output-file">
     <div class="property-title">
      output
     </div>
     standard output
    </div>
   </div>
   <div>
    <p>
     During the breaks between competitions, top-model Izabella tries to develop herself and not to be bored. For example, now she tries to solve Rubik's cube 2x2x2.
    </p>
    <p>
     It's too hard to learn to solve Rubik's cube instantly, so she learns to understand if it's possible to solve the cube in some state using 90-degrees rotation of one face of the cube in any direction.
    </p>
    <p>
     To check her answers she wants to use a program which will for some state of cube tell if it's possible to solve it using one rotation, described above.
    </p>
    <p>
     Cube is called solved if for each face of cube all squares on it has the same color.
    </p>
    <p>
     <a>
      https://en.wikipedia.org/wiki/Rubik's_Cube
     </a>
    </p>
   </div>
   <div class="input-specification">
    <div class="section-title">
     Input
    </div>
    <p>
     In first line given a sequence of 24 integers
     <span class="tex-span">
      <i>
       a
      </i>
      <sub class="lower-index">
       <i>
        i
       </i>
      </sub>
     </span>
     (
     <span class="tex-span">
      1 ≤
      <i>
       a
      </i>
      <sub class="lower-index">
       <i>
        i
       </i>
      </sub>
      ≤ 6
     </span>
     ), where
     <span class="tex-span">
      <i>
       a
      </i>
      <sub class="lower-index">
       <i>
        i
       </i>
      </sub>
     </span>
     denotes color of
     <span class="tex-span">
      <i>
       i
      </i>
     </span>
     -th square. There are exactly 4 occurrences of all colors in this sequence.
    </p>
   </div>
   <div class="output-specification">
    <div class="section-title">
     Output
    </div>
    <p>
     Print «
     <span class="tex-font-style-tt">
      YES
     </span>
     » (without quotes) if it's possible to solve cube using one rotation and «
     <span class="tex-font-style-tt">
      NO
     </span>
     » (without quotes) otherwise.
    </p>
   </div>
   <div class="sample-tests">
    <div class="section-title">
     Examples
    </div>
    <div class="sample-test">
     <div class="input">
      <div class="title">
       Input
      </div>
      <pre>2 5 4 6 1 3 6 2 5 5 1 2 3 5 3 1 1 2 4 6 6 4 3 4<br/></pre>
     </div>
     <div class="output">
      <div class="title">
       Output
      </div>
      <pre>NO</pre>
     </div>
     <div class="input">
      <div class="title">
       Input
      </div>
      <pre>5 3 5 3 2 5 2 5 6 2 6 2 4 4 4 4 1 1 1 1 6 3 6 3<br/></pre>
     </div>
     <div class="output">
      <div class="title">
       Output
      </div>
      <pre>YES</pre>
     </div>
    </div>
   </div>
   <div class="note">
    <div class="section-title">
     Note
    </div>
    <p>
     In first test case cube looks like this:
    </p>
    <center>
     <img class="tex-graphics" src="/predownloaded/63/c1/63c199258132ebbf9267e30d8e9cfaae55cb79db.png" style="max-width: 100.0%;max-height: 100.0%;"/>
    </center>
    <p>
     In second test case cube looks like this:
    </p>
    <center>
     <img class="tex-graphics" src="/predownloaded/a0/8d/a08d9d011b42847173a671061d354bf25c64684f.png" style="max-width: 100.0%;max-height: 100.0%;"/>
    </center>
    <p>
     It's possible to solve cube by rotating face with squares with numbers 13, 14, 15, 16.
    </p>
   </div>
  </div>
  <p>
  </p>
 </div>
</div>
